package umaine.ece471.cookbook;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class RecipeViewer extends Activity {
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.recipeview);

		this.setTitle("Cookbook - Selected Recipe");

		
		Intent intent = getIntent();
		String dataString = intent .getStringExtra("dataString");
		
		Recipe myRecipe = new Recipe(dataString);
		
		TextView recipeName = (TextView) findViewById(R.id.recipe_view_recipe_name);
		recipeName.setText(myRecipe.recipe_recipename);
		TextView creatorName = (TextView) findViewById(R.id.recipe_view_cook_name);
		creatorName.setText(myRecipe.recipe_creator);
		
		TextView ingredient1 = (TextView) findViewById(R.id.recipe_view_ingredient1);
		ingredient1.setText(myRecipe.recipe_ingredient1);
		TextView ingredient2 = (TextView) findViewById(R.id.recipe_view_ingredient2);
		ingredient2.setText(myRecipe.recipe_ingredient2);
		TextView ingredient3 = (TextView) findViewById(R.id.recipe_view_ingredient3);
		ingredient3.setText(myRecipe.recipe_ingredient3);
		TextView ingredient4 = (TextView) findViewById(R.id.recipe_view_ingredient4);
		ingredient4.setText(myRecipe.recipe_ingredient4);
		TextView ingredient5 = (TextView) findViewById(R.id.recipe_view_ingredient5);
		ingredient5.setText(myRecipe.recipe_ingredient5);
		TextView ingredient6 = (TextView) findViewById(R.id.recipe_view_ingredient6);
		ingredient6.setText(myRecipe.recipe_ingredient6);
		TextView ingredient7 = (TextView) findViewById(R.id.recipe_view_ingredient7);
		ingredient7.setText(myRecipe.recipe_ingredient7);
		TextView ingredient8 = (TextView) findViewById(R.id.recipe_view_ingredient8);
		ingredient8.setText(myRecipe.recipe_ingredient8);
		TextView ingredient9 = (TextView) findViewById(R.id.recipe_view_ingredient9);
		ingredient9.setText(myRecipe.recipe_ingredient9);
		
		TextView unit1 = (TextView) findViewById(R.id.recipe_view_unit1);
		unit1.setText(myRecipe.recipe_unit1);
		TextView unit2 = (TextView) findViewById(R.id.recipe_view_unit2);
		unit2.setText(myRecipe.recipe_unit2);
		TextView unit3 = (TextView) findViewById(R.id.recipe_view_unit3);
		unit3.setText(myRecipe.recipe_unit3);
		TextView unit4 = (TextView) findViewById(R.id.recipe_view_unit4);
		unit4.setText(myRecipe.recipe_unit4);
		TextView unit5 = (TextView) findViewById(R.id.recipe_view_unit5);
		unit5.setText(myRecipe.recipe_unit5);
		TextView unit6 = (TextView) findViewById(R.id.recipe_view_unit6);
		unit6.setText(myRecipe.recipe_unit6);
		TextView unit7 = (TextView) findViewById(R.id.recipe_view_unit7);
		unit7.setText(myRecipe.recipe_unit7);
		TextView unit8 = (TextView) findViewById(R.id.recipe_view_unit8);
		unit8.setText(myRecipe.recipe_unit8);
		TextView unit9 = (TextView) findViewById(R.id.recipe_view_unit9);
		unit9.setText(myRecipe.recipe_unit9);
		
		TextView size1 = (TextView) findViewById(R.id.recipe_view_size1);
		size1.setText(myRecipe.recipe_size1);
		TextView size2 = (TextView) findViewById(R.id.recipe_view_size2);
		size2.setText(myRecipe.recipe_size2);
		TextView size3 = (TextView) findViewById(R.id.recipe_view_size3);
		size3.setText(myRecipe.recipe_size3);
		TextView size4 = (TextView) findViewById(R.id.recipe_view_size4);
		size4.setText(myRecipe.recipe_size4);
		TextView size5 = (TextView) findViewById(R.id.recipe_view_size5);
		size5.setText(myRecipe.recipe_size5);
		TextView size6 = (TextView) findViewById(R.id.recipe_view_size6);
		size6.setText(myRecipe.recipe_size6);
		TextView size7 = (TextView) findViewById(R.id.recipe_view_size7);
		size7.setText(myRecipe.recipe_size7);
		TextView size8 = (TextView) findViewById(R.id.recipe_view_size8);
		size8.setText(myRecipe.recipe_size8);
		TextView size9 = (TextView) findViewById(R.id.recipe_view_size9);
		size9.setText(myRecipe.recipe_size9);
		
		
		
		
		
		
		TextView prepTime = (TextView) findViewById(R.id.recipe_view_prepTime);
		prepTime.setText(myRecipe.recipe_prepTime);		
		TextView cookTime = (TextView) findViewById(R.id.recipe_view_cookTime);
		cookTime.setText(myRecipe.recipe_cookTime);
		
		TextView instructions = (TextView) findViewById(R.id.recipe_view_instructions);
		instructions.setText(myRecipe.recipe_instructions);
		
		Button homeButton  = (Button) findViewById(R.id.recipe_view_home_button);
		homeButton.setOnClickListener(new View.OnClickListener() {

			public void onClick(View arg0){
				Intent goHome = new Intent(RecipeViewer.this, CookbookActivity.class);
				startActivity(goHome);
				
			}
			
		});	
	}
}
